<?php
/***************************************************************************
 *   copyright : (C) 2009 Udrea Cristian
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
include("include/session.php");
include("include/classes/class.AuctionHandler.php");

if( $session->logged_in && isset($_GET['op']) && 
	( isset($_GET['id']) && is_numeric($_GET['id']) ) ) {
	
	$id = $_GET['id'];
	$ukey = $session->userinfo['userkey'];
	$auction_data = $auctionDB->getAuctionData($id);
	if(count($auction_data) && $auctionDB->existsAuctionOrder($id, $ukey) == TRUE)
	{	
		switch($_GET['op']) {
			case 'accept' :
				$auctionDB->acceptAuctionOrder($id, $ukey);
				break;
			case 'refuse' :
				$auctionDB->refuseAuctionOrder($id, $ukey);
				break;
			case 'pay' :
				$auctionDB->payAuctionOrder($id, $ukey);
				break;
			default:
				break;
		}
	}
}
header('Location: content.php?content=1');
?>
